import http from "@/api/http";
import { string } from "vue-types";

export function getDBPage(query: object) {
  return http.get({
    url: "/tool/gen/db/page",
    params: query
  });
}

export function importTable(tableNames: any) {
  return http.post({
    url: "/tool/gen/import",
    data: tableNames
  });
}

export function getPage(query: object) {
  return http.get({
    url: "/tool/gen/page",
    params: query
  });
}

export function getGenTable(tableId: number) {
  return http.get({
    url: "/tool/gen/" + tableId,
  });
}

export function updateGenTable(obj: any) {
  return http.put({
    url: "/tool/gen",
    data: obj,
  });
}

export function delGenTable(ids: any) {
  return http.delete({
    url: "/tool/gen/" + ids,
  });
}

export function syncGenTable(tableName: string) {
  return http.get({
    url: "/tool/gen/sync/" + tableName,
  });
}

export function previewTable(tableId: number) {
  return http.get({
    url: "/tool/gen/preview/" + tableId,
  });
}
